<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include/head.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<!-- Website Title -->
		<title>登陆</title>
		<!-- Meta data for SEO -->
		<meta name="description" content="" />
		<meta name="keywords" content="" />
		<!-- Template stylesheet -->
		<link rel="stylesheet" href="${res}/css/screen.css" type="text/css" media="all" />
<!--[if IE 7]>
	<link href="css/ie7.css" rel="stylesheet" type="text/css" media="all">
<![endif]-->
		<!--[if IE]>
	<script type="text/javascript" src="js/excanvas.js"></script>
<![endif]-->
<script language="javascript" src="<%=request.getContextPath()%>/script/jquery.min.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/res/js/tools.js"></script>
<script type="text/javascript">
/**
 * function validate(){
   var code=$("#code").value();
   $.ajax( {
   	type : "POST",
   	url : "<%=request.getContextPath()%>/validate.do?code=" + code,
   	dataType: "json",
   	success : function(data) {
   		if(data.SUCCESS == "true"){
   			$("#code").value("");
   		}
   		else{
   		  	$("#code").value("");
   			$("#login_info").show();
   			$("#login_info").html("");
   			$("#login_info").html("<p><img src='${res}/images/icon_info.png' alt='success' class='middle' /></p>");
   		}
   	},
   	error :function(){
   		alert("网络连接出错！");
   	}
   });
   }
 */

$(function(){
	$("#registBtn").click(function(){
	  	window.location.href='<%=request.getContextPath()%>/admin/regist.page';
	});
	var loginInfo=getCookie("remenber");
	if(loginInfo!=""){
		var i=loginInfo.indexOf("sessionId:");
		var encryptedStr=loginInfo.substring(14,46);
		var sessionId=loginInfo.substring(56,loginInfo.length-1);
		$.ajax({
	   	type : "POST",
	   	url : "<%=request.getContextPath()%>/admin/login_cookies.do",
		data: "encryptedStr:"+encryptedStr+"sessionId:"+sessionId,
	   	dataType: "text",
	   	success : function(data) {
		   	var obj=eval("("+data+")");
		   	alert(obj);
	   		if(obj.SUCCESS == "true"){
		   		alert("登陆成功");
				window.location.href="<%=request.getContextPath() %>/admin/index.page";
	   		}
	   	},
	   	error :function(){
	   		alert("网络连接出错！");
	   	}
	   });
	}
});
</script>
</head>
	</head>
	<body class="login">
		<!-- Begin control panel wrapper -->
		<div id="wrapper">
			<div id="login_top">
				<img src="${res}/images/logo.gif" alt="" />
			</div>

			<br class="clear" />
			<br />
			<!-- Begin one column box -->
			<div class="onecolumn" style="width: 340px; margin: auto">
				<div class="header">
					<h2>
						登陆
					</h2>
				</div>
				<div class="content">
					<c:if test="${loginstatus!=null}">
						<div id="login_info" class="alert_error" style="margin: auto; padding: auto;">
							<p>${loginstatus}</p>
						</div>
					</c:if>
					<br class="clear" />
					<form action="login.do" method="post" id="form_login" name="form_login">
						<p style="font-size: 16px;line-height: 30px;">
							用户名<input type="text" id="username" name="username"
								style="width: 215px;float:right;" title="输入用户名" />
						</p>
						<br />
						<p style="font-size: 16px;line-height: 30px;">
							密&nbsp;&nbsp;&nbsp;&nbsp;码<input type="password" id="password" name="password"
								style="width: 215px;float:right;" title="输入密码" />
						</p>
						<br />
						<input type="checkbox" id="remember" name="remember" />
						<span style="font-size: 11px; margin-left: 5px">今天免登陆</span>
						<p style="margin-top: 30px">
							<input type="submit" class="button_dark" value="登&nbsp;&nbsp;&nbsp;&nbsp;陆" />
							<input id="registBtn" type="button" class="button_dark" value="注&nbsp;&nbsp;&nbsp;&nbsp;册" />
						</p>
					</form>
				</div>
			</div>
		</div>
		<!-- End control panel wrapper -->
		<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push( [ '_setAccount', 'UA-203192-14' ]);
  _gaq.push( [ '_setDomainName', 'none' ]);
  _gaq.push( [ '_setAllowLinker', true ]);
  _gaq.push( [ '_trackPageview' ]);

  (function() {
    var ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
  })();
</script>
	</body>
</html>